
// import { useI18n } from "vue-i18n";
// const { t } = useI18n();
export async function copyToClipboard(text:string|number|null|undefined) {
  if (process.client) {
    let tmpTextField: any = document.createElement("textarea");
    tmpTextField.textContent = text;
    tmpTextField.setAttribute("style", "position:absolute; right:200%;");
    document.body.appendChild(tmpTextField);
    tmpTextField.select();
    tmpTextField.setSelectionRange(0, 99999); /*For mobile devices*/
    document.execCommand("copy");
    const nuxtApp: any = useNuxtApp();
    console.log(nuxtApp.vueApp);
    if (nuxtApp.vueApp?.__VUE_I18N__) {
      let { t } = nuxtApp.vueApp["__VUE_I18N__"]["global"];
      ElMessage({
        message: t("language.commontips.copysuccess"),
        type: "success",
        duration: 1000,
      });
    }
    
  }
}

